$(function(){
  var storage = window.localStorage;
  var token = storage.token;
  if (token) {
    $.ajax({
      url: "http://ce.shi/public/verification.php",
      type: "post",
      data: {
        token: token
      },
      dataType: "JSON",
      cache: false, //同步请求
      ContentType: "application/xml;charset=utf-8",
      success: function (res) {
        $('.xs-StuName').append(res['StuName'])
        $('.xs-StuNo').append(res['StuNo'])

        // 进行已经选课的查询   拿token去换id然后查询具体的课

        var id ='00'+ res.id;
        $.ajax({
          url: "http://ce.shi/xuanke/people.php",
          type: "post",
          data: {
            id:id
          },
          dataType: "JSON",
          cache: false, //同步请求
          ContentType: "application/xml;charset=utf-8",
          success: function (res) {
            console.log(res)
            $('.select-info').append("<tr><td>1."+res.CouName+"</td><td>"+res.SchoolTime+"</td><td>"+res.Credit+"</td></tr>")
          },
          error:function(err){
            console.log('登录失败')
          }
        });
        console.log(id)
      },
      error: function (err) {
        console.log('请求失败')
      }
    });
  } else {
    console.log('暂未登录进行页面跳转')
  }

  

})